const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'main.js',
        path: path.resolve(__dirname, 'dist'),
    },
    plugins: [new HtmlWebpackPlugin({
        template: 'src/index.html',
        filename: './index.html',
        chunks: ['main']
    })],
    devServer: {
        static: {
            directory: path.resolve(__dirname, '/src'),
        },
        hot: true,//热更新 

        port: 9000,               //设置端口
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [ 'style-loader', 'css-loader' ]
            }
        ]
    },
    mode: "development"
};